shader brick(
        float thick=0.02,
        float rat=5.6,
        float  rep=6,
        color MainColor = color(1.0,0.0,0.6),
        color EdgeColor = color(1.0,0.0,0.0),
        output color c = 0 )
{
    color col=color(1,0.23,0.13);
    float x=rep*u;
    float y=rat*rep*v;
    
    if(mod(y, 2.0) < 1.0) x=x+0.5;
    
    x *= (1+0.7*noise("cell", y));
    
    float nx=x-floor(x);
    float ny=y-floor(y);
    
    if(nx>1-thick || ny<rat*thick) { 
        col=color(0.9); 
    }
    else {
        float brg = 0.5*noise("cell", point(floor(x),floor(y),0))+0.3;    
        col = brg*col;
    }
    c = col;
}